<%@ page language="java" import="java.util.*" pageEncoding="utf-8" contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%-- ssx --%>
<!DOCTYPE HTML>
<html>
<head>
    <base href="<%=basePath %>">
    <title>体验品管理</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <%-- 引用layui.css --%>
    <link rel="stylesheet" type="text/css" href="<%=basePath %>js/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="<%=basePath %>css/common.css"/>
</head>
<body>
<div class="ibox">
    <div class="ibox-content bodycss">
        <!-- 表单搜索 开始 -->
        <section class="panel panel-padding ">
            <form class="layui-form layui-form-pane form-search"
                  onsubmit="return false" method="get">

                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">商品名称</label>
                    <div class="layui-input-inline">
                        <input name="goods_name" id="goods_name" value="" placeholder="请输入名称"
                               class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">供应商名称</label>
                    <div class="layui-input-inline">
                        <input name="supplier_name" id="supplier_name" value="" placeholder="请输入名称"
                               class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">服务点名称</label>
                    <div class="layui-input-inline">
                        <input name="area_name" id="area_name" value="" placeholder="请输入名称"
                               class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item layui-inline">
                    <button class="layui-btn layui-btn-primary" lay-submit lay-filter="seach">
                        <i class="layui-icon"></i> 搜 索
                    </button>
                </div>
            </form>
        </section>
        <!-- 表单搜索 结束 -->


        <section class="panel panel-padding ">

            <table class="layui-table"

                   lay-data="{
	                        id:'menuTeble',
	                        width:'auto',
	                        url:'typgl/list.do',
	                        page:true,
	                        even:true,
	                        skin:'row',
	                        limits:[10,20,30,40,50],
	                        limit:10}"
                   lay-filter="popedomLay">

                <thead>
                <tr>
                    <!-- <th lay-data="{checkbox:true,disabledKey:'check_status',disabledKeyValue:'1,2'}"></th> -->
                    <th lay-data="{type:'numbers', width:50}">序号</th>
                    <!-- <th lay-data="{field:'goods_id', width:120,align:'center'}">商品ID</th> -->
                    <th lay-data="{field:'goods_name', width:120,align:'center'}">商品名称</th>
                    <th lay-data="{field:'common_price', width:200,align:'center'}">商品价格</th>
                    <th lay-data="{field:'specifications', width:200,align:'center'}">商品规格</th>
                    <!-- <th lay-data="{field:'supplier_id', width:120,align:'center'}">供应商ID</th> -->
                    <th lay-data="{field:'supplier_name', width:120,align:'center'}">供应商名称</th>
                    <!-- <th lay-data="{field:'service_point_id', width:200,align:'center'}">服务点ID</th> -->
                    <th lay-data="{field:'area_name', width:200,align:'center'}">服务点名称</th>
                    <th lay-data="{field:'shipping_fee', width:200,align:'center'}">运费</th>
                    <th lay-data="{field:'awarded_integral', width:200,align:'center'}">赠送积分</th>
                    <%--<th lay-data="{field:'thumb_picPath', width:200,align:'center', templet:'#thumb_picPath'}">列表图片</th>
                    <th lay-data="{field:'picPath1', width:200,align:'center', templet:'#picPath1'}">详情图1</th>
                    <th lay-data="{field:'picPath2', width:200,align:'center', templet:'#picPath2'}">详情图2</th>
                    <th lay-data="{field:'picPath3', width:200,align:'center', templet:'#picPath3'}">详情图3</th>
                    <th lay-data="{field:'picPath4', width:200,align:'center', templet:'#picPath4'}">详情图4</th>
                    <th lay-data="{field:'picPath5', width:200,align:'center', templet:'#picPath5'}">详情图5</th>
                    <th lay-data="{field:'info_picPath', width:200,align:'center', templet:'#info_picPath'}">内容介绍图</th>--%>
                    <th lay-data="{fixed: 'right', width:350, align:'center', toolbar: '#popedomBar'}">操作</th>
                </tr>
                </thead>

            </table>

        </section>
    </div>
</div>
<%--<!-- 对图片显示操作 -->
<!-- 列表图片 -->
<script type="text/html" id="thumb_picPath">
    <img src='{{d.thumb_picPath }}'/>
</script>
<!-- 详情图1~5 -->
<script type="text/html" id="picPath1">
    <img src="{{d.picPath1 }}"/>
</script>
<script type="text/html" id="picPath2">
    <img src="{{d.picPath2 }}"/>
</script>
<script type="text/html" id="picPath3">
    <img src="{{d.picPath3 }}"/>
</script>
<script type="text/html" id="picPath4">
    <img src="{{d.picPath4 }}"/>
</script>
<script type="text/html" id="picPath5">
    <img src="{{d.picPath5 }}"/>
</script>
<!-- 内容介绍图 -->
<script type="text/html" id="info_picPath">
    <img src="{{d.info_picPath }}"/>
</script>--%>
<!-- 操作项 -->
<script type="text/html" id="popedomBar">
    <a class="layui-btn layui-bg-blue layui-btn-xs" lay-event="edit">修改信息</a>
    <a class="layui-btn layui-bg-blue layui-btn-xs" lay-event="edits">修改图片</a>
</script>
<script type="text/javascript" src="<%=basePath %>js/layui/layui.js"></script>
<script type="text/javascript">

    layui.config({
        base: "<%=basePath%>/js/common/"
    }).use(["common", "element", "layer", "form", "table", "jquery"], function () {
        var elem = layui.element;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var $ = layui.jquery;
        layui.common.init();
        /**
         * 监听刷新表格
         *  搜索请求
         */
        form.on('submit(seach)', function (data) {
            //	console.log(JSON.stringify(data.field));
            table.reload('menuTeble', {
                where: data.field,
                page: {
                    curr: 1
                }
            });
            return false;
        });


        /*
             监听行事件

        **/
        table.on('tool(popedomLay)', function (obj) {
            var data = obj.data;
            var supplierId = data.supplierId;
            var supplierStatus = data.supplierStatus;
            //console.log(supplierStatus)
            if (obj.event === 'edit') {
                layer.open({
                    type: 2,
                    title: '修改体验品信息',
                    content: 'Typgl/updates.do',
                    area: ['600px', '500px'],
                    anim: 5,
                    isOutAnim: true,
                    maxmin: true,
                    resize: false,
                    moveOut: true,
                    zIndex: 99999,
                    success: function (layero, index) {
                        var body = layer.getChildFrame('body', index);
                        body.contents().find("INPUT[name='goods_id']").val(data.goods_id);
                        body.contents().find("INPUT[name='goods_name']").val(data.goods_name);
                        body.contents().find("INPUT[name='common_price']").val(data.common_price);
                        body.contents().find("INPUT[name='specifications']").val(data.specifications);
                        body.contents().find("INPUT[name='supplier_id']").val(data.supplier_id);
                        body.contents().find("INPUT[name='supplier_name']").val(data.supplier_name);
                        body.contents().find("INPUT[name='service_point_id']").val(data.service_point_id);
                        body.contents().find("INPUT[name='area_name']").val(data.area_name);
                        body.contents().find("INPUT[name='shipping_fee']").val(data.shipping_fee);
                        body.contents().find("INPUT[name='awarded_integral']").val(data.awarded_integral);
                    },
                    end: function () {
                        table.reload("menuTeble");
                    }

                });
            } else if (obj.event === 'edits') {
                layer.open({
                    type: 2,
                    title: '修改体验品图片信息',
                    content: 'Typgl/toPicsPage.do?goodsId=' + data.goods_id,
                    area: ['1500px', '800px'],
                    anim: 5,
                    isOutAnim: true,
                    maxmin: true,
                    resize: false,
                    moveOut: true,
                    zIndex: 99999,
                    success: function (layero, index) {
                        var body = layer.getChildFrame('body', index);
                    },
                    end: function () {
                        table.reload("menuTeble");
                    }
                });
            }
        });


    });
</script>

</body>
</html>
